#!/usr/bin/python
# -*- coding: UTF-8 -*-  

"TestCustomizationClass"

__author__ = "Wang Zhe"

class Fib(object):
    """docstring for Fib"""
    a ,b= 0,1
    def __init__(self):
        super(Fib, self).__init__()

    def __iter__(self):
        return self

    def __next__(self):
        self.a,self.b = self.b,self.a +self.b
        if(self.a > 10**2):
            raise StopIteration()
        return self.a

    def __getitem__(self,n):
        a,b = 1,1
        if isinstance(n,int):
            for x in range(n):
                a,b = b,a+b
            return a
        if isinstance(n,slice):
            start = n.start
            stop = n.stop
            if start is None:
                start = 0
            if stop is None:
                stop = 15
            L = []
            for x in range(stop):
                if x >= start:
                    L.append(a)
                a,b = b,a + b
            return L

def main():
    f = Fib()    
    L1 = []
    L2 = []   
    L3 = []
    L4 = [] 

    for x in Fib():
        L1.append(x)
    for x in range(12):
        L2.append(f[x])

    L3 = f[0:13]
    L4 = f[1:14]
    L5 = f[:]

    print(L1)
    print(L2)
    print(L3)
    print(L4)
    print(L5)

if __name__ == '__main__':
    main()